KanziViewAdapter allows embedding Kanzi UI content into an Android view. More...
Public Member Functions | |
KanziViewAdapter (Context context, String name) | |
Constructor to use when operating without a view. | |
KanziViewAdapter (View view, AttributeSet attrs) | |
Constructor to use when inflating a view from XML. | |
KanziViewAdapter (View view, String name) | |
Constructor to use when attaching to a view. | |
void | addListener (KanziViewListener listener) |
Adds a view state change listener. | |
Domain | getDomain () |
Gets the Domain associated with this view. | |
String | getName () |
Gets the name of the underlying native view node. | |
Node2D | getRoot () |
Returns the root node of the underlying native view's node tree. | |
KanziRuntime | getRuntime () |
Gets the KanziRuntime associated with this view. | |
void | handleActivityStarted () |
Notifies the adapter that the Activity has started. | |
void | handleActivityStopped () |
Notifies the adapter that the Activity has stopped. | |
void | handleAttachedToWindow () |
Notifies the adapter of the attachment of the associated view to a window. | |
void | handleDetachedFromWindow () |
Notifies the adapter of the detachment of the associated view from its window. | |
void | handleFocusChange (boolean hasFocus) |
Handles focus change. | |
boolean | handleGenericMotionEvent (MotionEvent event) |
Handles the specified rotary controller knob rotation event if the view is in direct manipulation mode. | |
boolean | handleKeyEvent (final int keyCode, KeyEvent event) |
Handles key events. | |
void | handleOrientationChange (int orientation) |
Applies device orientation changes to the Kanzi contents of associated view. | |
void | handleSurfaceChanged (Surface surface, int width, int height) |
Notifies the adapter of any changes in the dimensions of the surface of the associated view. | |
void | handleSurfaceCreated (Surface surface) |
Notifies the adapter of availability of surface of the associated view. | |
void | handleSurfaceDestroyed () |
Notifies the adapter of the destruction of the surface of the associated view. | |
boolean | handleTouchEvent (final MotionEvent event) |
Handles touch events. | |
void | handleVisibilityChange (boolean isVisible) |
Notifies the adapter that the visibility has changed. | |
void | removeListener (KanziViewListener listener) |
Removes a view state change listener. | |
void | setClearColor (ColorRGBA color) |
Configures the clear color that is used when rendering of the surface of the view. | |
void | setKzbPathList (String[] kzbPaths) |
Configures the list of kzb files that are loaded when the view is attached. | |
void | setName (String name) |
Sets the name for the underlying native view node. | |
void | setRoot (Node2D node) |
Sets the root node of the underlying native view's node tree, used to manually set content to the view. | |
void | setRotaryHandlingEnabled (boolean enable) |
Sets whether the adapter processes rotary controller events. | |
void | setStartupPrefabUrl (String url) |
Configures the startup prefab that is automatically loaded during initialization. | |
KanziViewAdapter allows embedding Kanzi UI content into an Android view.
Alternatively, you can use one of the Kanzi view classes: KanziSurfaceView and KanziTextureView.
KanziViewAdapter | ( | View | view, |
AttributeSet | attrs ) |
Constructor to use when inflating a view from XML.
view | Reference to the view being adapted. |
attrs | Attributes received when inflating the view from XML. |
KanziViewAdapter | ( | View | view, |
String | name ) |
Constructor to use when attaching to a view.
view | Reference to the view being adapted. |
name | A name for the underlying native view node. |
KanziViewAdapter | ( | Context | context, |
String | name ) |
Constructor to use when operating without a view.
context | Reference to the application context. |
name | A name for the underlying native view node. |
void addListener | ( | KanziViewListener | listener | ) |
Adds a view state change listener.
listener | An instance of KanziViewListener. |
Domain getDomain | ( | ) |
Gets the Domain associated with this view.
String getName | ( | ) |
Gets the name of the underlying native view node.
Node2D getRoot | ( | ) |
Returns the root node of the underlying native view's node tree.
KanziRuntime getRuntime | ( | ) |
Gets the KanziRuntime associated with this view.
void handleActivityStarted | ( | ) |
Notifies the adapter that the Activity has started.
Activates the view node.
void handleActivityStopped | ( | ) |
Notifies the adapter that the Activity has stopped.
Deactivates the view node.
void handleAttachedToWindow | ( | ) |
Notifies the adapter of the attachment of the associated view to a window.
Initializes runtime if this is the first Kanzi based view to be attached in this application. Initializes the underlying view node and initiates asynchronous loading of its start-up prefab if configured.
void handleDetachedFromWindow | ( | ) |
Notifies the adapter of the detachment of the associated view from its window.
Releases the underlying view node.
void handleFocusChange | ( | boolean | hasFocus | ) |
Handles focus change.
Call this to inform Kanzi of changes in the focus of a Kanzi-based-view. Kanzi view types com.rightware.kanzi.KanziSurfaceView
and com.rightware.kanzi.KanziTextureView
do this by default, so you don't have to.
hasFocus | True if the View has focus; false otherwise. |
boolean handleGenericMotionEvent | ( | MotionEvent | event | ) |
Handles the specified rotary controller knob rotation event if the view is in direct manipulation mode.
To handle rotary controller knob rotation events and translate them to focus navigation events, forward generic motion events to this function. Use this function to process rotary controller events of an arbitrary view that uses com.rightware.kanzi.KanziViewAdapter
. Kanzi views com.rightware.kanzi.KanziSurfaceView
and com.rightware.kanzi.KanziTextureView
forward all the generic motion events to this function, so you do not have to.
event | The MotionEvent object that defines the knob rotation action. |
boolean handleKeyEvent | ( | final int | keyCode, |
KeyEvent | event ) |
Handles key events.
You can forward key events received by Kanzi-based-view to this function, if you want Kanzi to handle them. Kanzi view types com.rightware.kanzi.KanziSurfaceView
and com.rightware.kanzi.KanziTextureView
do this by default, so you don't have to.
keyCode | a key code that represents the button pressed, from android.view.KeyEvent. |
event | the KeyEvent object that defines the button action. |
void handleOrientationChange | ( | int | orientation | ) |
Applies device orientation changes to the Kanzi contents of associated view.
orientation | The orientation qualifier from onOrientationChanged(). |
void handleSurfaceChanged | ( | Surface | surface, |
int | width, | ||
int | height ) |
Notifies the adapter of any changes in the dimensions of the surface of the associated view.
surface | The new surface |
width | The new width of the surface. |
height | The new height of the surface. |
void handleSurfaceCreated | ( | Surface | surface | ) |
Notifies the adapter of availability of surface of the associated view.
Sets the surface as the target of the graphics context of the underlying view node. Activates the view node.
surface | The surface |
void handleSurfaceDestroyed | ( | ) |
Notifies the adapter of the destruction of the surface of the associated view.
Detaches the graphics context of the underlying view node from this surface. Deactivates the view node.
boolean handleTouchEvent | ( | final MotionEvent | event | ) |
Handles touch events.
You can forward touch events received by Kanzi-based-view to this function, if you want Kanzi to handle them. Kanzi view types com.rightware.kanzi.KanziSurfaceView
and com.rightware.kanzi.KanziTextureView
do this by default, so you don't have to.
event | The touch event. |
void handleVisibilityChange | ( | boolean | isVisible | ) |
Notifies the adapter that the visibility has changed.
Use this method only when your application is in a view-less context, such as a WallpaperEngine.
Toggles the activation of the Kanzi View.
isVisible | Whether the surface is visible and must be rendered. |
void removeListener | ( | KanziViewListener | listener | ) |
Removes a view state change listener.
listener | The instance of KanziViewListener to remove. |
void setClearColor | ( | ColorRGBA | color | ) |
Configures the clear color that is used when rendering of the surface of the view.
color | Color used to clear the surface of the view. Use null to skip clearing. |
void setKzbPathList | ( | String[] | kzbPaths | ) |
Configures the list of kzb files that are loaded when the view is attached.
kzbPaths | Array of kzb paths to load. |
void setName | ( | String | name | ) |
Sets the name for the underlying native view node.
name | New name for native view node. |
void setRoot | ( | Node2D | node | ) |
Sets the root node of the underlying native view's node tree, used to manually set content to the view.
node | Reference to a node. |
void setRotaryHandlingEnabled | ( | boolean | enable | ) |
Sets whether the adapter processes rotary controller events.
enable | If true, the adapter processes rotary controller input, otherwise related input events are ignored. |
void setStartupPrefabUrl | ( | String | url | ) |
Configures the startup prefab that is automatically loaded during initialization.
url | Url of the prefab template to load. |